using Common.Communal;
using MediatR;
using Sell.Api.Write.Application.Command.ContractCommand;
using Sell.Services.Contracts;

namespace Sell.Api.Write.Application.CommandHandlers.ContractCommandHandlers
{
    public class ContractUpdateReviewStatusCommandHandler : IRequestHandler<ContractUpdateReviewStatusCommand, ApiResult<int>>
    {
        private readonly IContractServices _contractServices;

        public ContractUpdateReviewStatusCommandHandler(IContractServices contractServices)
        {
            _contractServices = contractServices;
        }

        /// <summary>
        /// 修改采购合同审核状态
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<ApiResult<int>> Handle(ContractUpdateReviewStatusCommand request, CancellationToken cancellationToken)
        {
            return await _contractServices.UpdateReviewStatus(request.Id, request.ReviewStatus);
        }
    }
}





